//
//  ViewController.m
//  Hwi_Library_Demo
//
//  Created by Jeonghwi Kim on 13. 7. 5..
//  Copyright (c) 2013년 KDML. All rights reserved.
//

#import "ViewController.h"

@implementation ViewController


#pragma mark - TableView Delegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.array01_functions.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
    cell.textLabel.text = [self.array01_functions objectAtIndex:indexPath.row];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    switch (indexPath.row) {
        case 0:
            [self performSegueWithIdentifier:@"SEG_HWI01_ADDCOMMA" sender:self];
            break;
        case 1:
            [self performSegueWithIdentifier:@"SEG_HWI02_JSON_NETWORK" sender:self];
            break;

        case 2:
            [self performSegueWithIdentifier:@"SEG_HWI03_EMAIL_CHECK" sender:self];
            break;
        case 3:
            [self performSegueWithIdentifier:@"SEG_HWI04_POSTOFFICE_API" sender:self];
            break;
        case 4:
            [self performSegueWithIdentifier:@"SEG_HWI05_CONTAINS" sender:self];
            break;
        case 5:
            [self performSegueWithIdentifier:@"SEG_HWI06_DATE_FORMAT" sender:self];
            break;
        case 6:
            [self performSegueWithIdentifier:@"SEG_HWI07_LOCATION_N_DISTANCE" sender:self];
            break;
        case 7:
            [self performSegueWithIdentifier:@"SEG_HWI08_PROGRESS_INDI" sender:self];
            break;
            
            
        default:
            [tableView deselectRowAtIndexPath:indexPath animated:YES];
            break;
    }
}

-(void)init_view
{
    self.array01_functions = [[NSMutableArray alloc] init];
    [self.array01_functions addObject:@"[01] Add comma"];
    [self.array01_functions addObject:@"[02] JSON Network"];
    [self.array01_functions addObject:@"[03] Email Validation"];
    [self.array01_functions addObject:@"[04] Post Office API"];
    [self.array01_functions addObject:@"[05] Is Contains"];
    [self.array01_functions addObject:@"[06] Date Formatting"];
    [self.array01_functions addObject:@"[07] Location & Distance"];
    [self.array01_functions addObject:@"[08] Progress Bar"];    
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self init_view];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
